import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/oauth/login',
    method: 'post',
    params: data
  })
}

export function getInfo(token) {
  return request({
    url: '/oauth/info',
    method: 'get',
    params: { token }
  })
}

export function logout(token) {
  return request({
    url: '/oauth/logout',
    method: 'post',
    params: { token: token }
  })
}

export function updatePassword({ oldPassword, newPassword }) {
  return request({
    url: '/oauth/updatePassword',
    method: 'post',
    data: {
      oldPassword: oldPassword,
      newPassword: newPassword
    }
  })
}

export function getMenu() {
  return request({
    url: '/upms/routers/page',
    method: 'post',
    data: {
      baseParams: {},
      sort: 'seq asc'
    }
  })
}
